#!/bin/sh

# ----------------------------------------------------------------------------
# Script maintaining versions
#
# Bump up next build development version for parents.
# ----------------------------------------------------------------------------

find_basedir() {
  local basedir=$(cd -P -- "$(dirname -- "$0")" && cd .. && cd .. && pwd -P)
  echo "${basedir}"
}

export PROJECTBASEDIR=$(find_basedir)

(cd $PROJECTBASEDIR && ./mvnw build-helper:parse-version versions:update-parent -DgenerateBackupPoms=false -DallowSnapshots=true -DparentVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})' && ./mvnw build-helper:parse-version versions:update-property -DgenerateBackupPoms=false -DallowSnapshots=true -Dproperty=spring-cloud-deployer.version -DnewVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})' && ./mvnw build-helper:parse-version versions:update-property -DgenerateBackupPoms=false -DallowSnapshots=true -Dproperty=spring-cloud-deployer-local.version -DnewVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})' && ./mvnw build-helper:parse-version versions:update-property -DgenerateBackupPoms=false -DallowSnapshots=true -Dproperty=spring-cloud-deployer-cloudfoundry.version -DnewVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})' && ./mvnw build-helper:parse-version versions:update-property -DgenerateBackupPoms=false -DallowSnapshots=true -Dproperty=spring-cloud-deployer-kubernetes.version -DnewVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})' && ./mvnw build-helper:parse-version versions:update-property -DgenerateBackupPoms=false -DallowSnapshots=true -Dproperty=spring-cloud-skipper.version -DnewVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})' && ./mvnw build-helper:parse-version versions:update-property -DgenerateBackupPoms=false -DallowSnapshots=true -Dproperty=spring-cloud-dataflow-common.version -DnewVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})' && ./mvnw build-helper:parse-version versions:update-property -DgenerateBackupPoms=false -DallowSnapshots=true -Dproperty=spring-cloud-common-security-config.version -DnewVersion='[${parsedVersion.majorVersion}.${parsedVersion.minorVersion},${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion})')

